<!--督导评教-->
<template>
  <div class="wrapper-container">
    <div class="search-container" style="margin:0">
      <div class="search-container-left">
        <el-form
          :model="queryParams"
          ref="queryForm"
          :inline="true"
          v-show="showSearch"
        >
          <el-form-item label="学期:" prop="xq">
            <el-select
              v-model="queryParams.xueqi"
              style="width: 120px"
              placeholder="选择学期"
              clearable
              size="mini"
            >
              <el-option
                v-for="item in xqList"
                :key="item.xqmc"
                :label="item.xqmc"
                :value="item.xqmc"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              style="background-color: rgb(241 248 254); color: rgb(81 174 246); font-size: 14px;border-radius:6px"
              @click="handleQuery"
              >查询</el-button
            >
          </el-form-item>
        </el-form>
<!--        <div class="search-container-item">
          <span>学期：</span>
          <el-select
            v-model="xq"
            style="width: 90px"
            size="mini"
            placeholder="请选择"
          >
            <el-option
              v-for="item in xqList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>

        <div class="search-button" @click="handleQuery">
          <img src="../../../assets/assessment/icon-search.png" alt="" />
          <span>查询</span>
        </div>-->
      </div>

      <div class="search-container-item" style="margin-top:10px">
        学员可以查看自己评价的"教员-课程" (总: {{ many }}个) 前50%的名单:
      </div>
    </div>
    <div class="table-container">
      <el-table
        tooltip-effect="light"
        :data="tableData"
        style="width: 100%"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
      >
        <el-table-column
          prop="pjResult.teachername"
          label="上课教员"
          width="556px"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="pjEvalactor.coursename"
          label="课程名称"
          width="556px"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="pjEvalactor.classes"
          label="教学班"
          width="556px"
          align="center"
        >
        </el-table-column>
      </el-table>
    </div>
    <div class="bottom-block">
      <div class="text">授课教员名字后加“*”为课程负责人</div>
    </div>
  </div>
</template>

<script>
import { evaResultS } from "../../../api/courseExame/stuEvaTea";
import { reqGetXqList } from "@/api/course/courses";
import { getStore } from '@/util/store.js'

export default {
  data() {
    return {
      queryParams: {
        // studentid: "200107",
        xueqi: ""
      },
      showSearch: true,
      currentCell: "",
      xq: "",
      xqList: [],
      many: "",
      tableData: []
    };
  },
  created() {
    console.log(this.userInfo,"11111")
    const userInfo = getStore({
      name: "userInfo",
      debug: true,
    }) || {}
    this.roleId = userInfo.content.role_id;
    console.log(this.roleId)
    this.getXqList();
  },
  methods: {
    // 获取学期院历列表
    async getXqList() {
      const result = await reqGetXqList();
      if (result.data.code == 200) {
        this.xqList = result.data.data;
        this.queryParams.xueqi = result.data.data.length > 0 ? result.data.data[0].xqmc: ''
        this.evaResLook(this.queryParams);
      }
    },
    evaResLook() {
      evaResultS(this.queryParams).then(res => {
        this.tableData = res.data.data.indexZhiBiaoList;
        this.many = res.data.data.many;
      });
    },

    handleQuery() {
      // this.evaResLook();
      //查询到数据进行回显，有数据显示，没数据就是空的
      evaResultS(this.queryParams).then(res => {
        this.tableData = res.data.data.pjEvalactors;
        this.many = res.data.data.many;
        console.log("===================" + this.tableData.many);
      });
    },

    dealCommonn(item) {
      return item.substring(0, 36) + "...";
    },
    cellMouseEnter(index) {
      this.currentCell = index;
    },
    cellLeave() {
      this.currentCell = "";
    }
  }
};
</script>
<style lang="less" scoped>
/deep/.el-form-item__label{
  color: #004ca7;
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  margin: 15px 0;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
.table-container {
  margin-top: 30px;
  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }
  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }
  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    > div {
      margin-bottom: 8px;
    }
  }
  .search-button {
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 27px;
    background: #f1f8fe;
    border: 1px solid #51aef6;
    border-radius: 6px;

    > span {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #51aef6;
    }
    > img {
      width: 19px;
      height: 19px;
      margin-right: 4px;
    }
  }
  .edit-button {
    .search-button;
    background: #dfffef;
    border: 1px solid #02c86c;
    > span {
      color: #02c86c;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/supervision.less";
.wrapper-container .search-container[data-v-0b21611f] {
  margin-top: 27px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.search-container-right {
  display: flex;
  margin-top: 20px;
  width: 593px;
  height: 26px;
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #004ca7;
  opacity: 1;
}

.table-container {
  margin-top: 30px;
  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}
</style>
